
// Function.prototype.bind = function(context) {
//     var self = this

//     return self.apply(context,arguments)
// }

function myBind (context) {
    var self = this

    return self.apply(context,arguments)
}

Function.prototype.myBind = myBind

var obj = {
    name: "1",
    getName: function() {
        console.log(this.name);
    }
}

var getName = obj.getName

console.log(getName()); //undefined

console.log(getName.myBind(obj)); // 输出"1"